﻿@using PagedList;
@using PagedList.Mvc;

@model IEnumerable<EventSys.BussinesEntities.Participante>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <link href="@Url.Content("~/Content/PagedList.css")" rel="stylesheet" type="text/css" />
}

<h1>Participantes</h1>
<div class="franja_rayas"></div>
@*<p>
    @Html.ActionLink("Create New", "Create")
</p>*@

@using (Html.BeginForm())
{
    <fieldset>
        <legend>Buscar Participante</legend>
        <b>Criterio:</b>
        <input type="search" name="criterio" value="" placeholder="Ingrese Código o Dni" maxlength="8" />
        <input type="submit" name="btnBuscar" value="Buscar" />
    </fieldset>
}

<div class="CSSTableGenerator">

    <table>
        <tr>
            @* <th>
            @Html.DisplayNameFor(model => model.idParticipante)
        </th>*@
            <th>
                @Html.DisplayNameFor(model => model.CodigoUpn)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.DNI)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Nombres)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Apellidos)
            </th>
            @*<th>
            @Html.DisplayNameFor(model => model.Profesion)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CentroEstudios)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Grado)
        </th>*@
            <th>
                @Html.DisplayNameFor(model => model.Email)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Direccion)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Telefono)
            </th>
            @*<th>
            @Html.DisplayNameFor(model => model.Cargo)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CentroLaboral)
        </th>*@
            <th>
                @Html.DisplayNameFor(model => model.IdUbigeo)
            </th>
            @*<th>
            @Html.DisplayNameFor(model => model.ExperienciaLaboral)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.GradosyCertificaciones)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Especializaciones)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Publicaciones)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Contraseña)
        </th>*@
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                @*<td>
            @Html.DisplayFor(modelItem => item.idParticipante)
        </td>*@
                <td>
                    @Html.DisplayFor(modelItem => item.CodigoUpn)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.DNI)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Nombres)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Apellidos)
                </td>
                @*<td>
            @Html.DisplayFor(modelItem => item.Profesion)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CentroEstudios)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Grado)
        </td>*@
                <td>
                    @Html.DisplayFor(modelItem => item.Email)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Direccion)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Telefono)
                </td>
                @*<td>
            @Html.DisplayFor(modelItem => item.Cargo)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CentroLaboral)
        </td>*@
                <td>
                    @Html.DisplayFor(modelItem => item.Ubigeo.Nombre)
                </td>
                @*<td>
            @Html.DisplayFor(modelItem => item.ExperienciaLaboral)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.GradosyCertificaciones)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Especializaciones)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Publicaciones)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Contraseña)
        </td>*@
                <td>@Html.ActionLink("Editar", "Edit", new { id = item.idParticipante })</td>
                <td>@Ajax.ActionLink("Detalles", "Index", new AjaxOptions()
               {
                   Url = Url.Action("Details", new { id = item.idParticipante }),
                   UpdateTargetId = "upDetails",
                   OnSuccess = "OnSuccessDetails"
               })</td>
                <td>@Html.ActionLink("Eliminar", "Delete", new { id = item.idParticipante })</td>


            </tr>
        }

    </table>
</div>

@*<div>
    @Html.PagedListPager(Model, page => Url.Action("Index", new { page })) 
</div>*@

<div id="upDetails"></div>

@section scripts{
    <script type="text/javascript">
        function OnSuccessDetails(data) {
            $("#frmDetails").dialog({
                modal: true,
                width: 600,
                buttons: {
                    'Cerrar': function () {
                        $(this).dialog('close');
                    }
                },
                close: function () {
                    $(this).parent().remove();
                    $(this).remove();
                }
            });
        }


    </script>
}
